
import * as types from '../store/action-types';
import {put,call,take,takeEvery,race} from 'redux-saga/effects';
import {delay3} from '../utils';
function* increment(){
    while(true){
        yield call(delay3,1000);
        yield put({type:types.INCREMENT});
    }
}
export default function* counterSaga(){
   yield takeEvery(types.START,increment);  
    //两个effect会同时开始执行,
   yield race({
       //如果有一个完成了，其它 任务会自动取消
       increment:call(increment),
       stop:take(types.STOP)
   });
}